import request from "@/server/request.js";

// 发送短信
export const sms = (params) => {
	return new request().requestPost(`/api/user/registerCode`, params);
};

// 用户注册
export const authRegister = (params) => {
	return new request().requestPost(`/api/user/register`, params);
};

// 用户登录（验证码|密码）
export const loginBySmsAndPsw = (params) => {
	return new request().requestPost(`/api/user/login`, params);
};

// 用户信息
export const userProfile = (params) => {
	return new request().requestGet(`/api/user/profile`, params);
};

// 修改用户名
export const updateUsername = (params) => {
	return new request().requestPost(`/api/user/updateName`, params);
};

// 修改用户头像
export const updateAvatar = (params) => {
	return new request().requestUpload(`/api/user/updateAvatar`, params);
};

// 修改密码
export const updatePassword = (params) => {
	return new request().requestPost(`/api/user/updatePassword`, params);
};

// 旧邮箱验证
export const verifyOldEmail = (params) => {
	return new request().requestPost(`/api/user/verify/oldEmail`, params);
};

// 修改邮箱
export const updateEmail = (params, token) => {
	return new request().requestPost(`/api/user/updateEmail`, params, true, token);
};

// 退出登录
export const userLogout = (params) => {
	return new request().requestPost(`/api/user/logout`, params);
};

// 当前总资产
export const userAssets = (params) => {
	return new request().requestGet(`/api/user/assets/`, params);
};

// 总资产历史记录
export const userAssetsRecords = (params) => {
	return new request().requestGet(`/api/user/assets/records`, params);
};

// 通用验证码(这个在登录后才能使用，如果携带了email，则给这个email发验证码)
export const userVerifyCode = (params) => {
	return new request().requestPost(`/api/user/verifyCode`, params);
};




















// 金币充值套餐
export const coinPackages = (params) => {
	return new request().requestGet(`/api/v1/coin/packages`, params);
};

// 金币充值
export const coinRecharge = (params) => {
	return new request().requestPost(`/api/v1/coin/recharge`, params);
};

// 金币明细
export const coinLogs = (params) => {
	return new request().requestGet(`/api/v1/coin/logs`, params);
};

// 修改密码(旧密码)
export const resetPassword = (params) => {
	return new request().requestPost(`/api/v1/auth/resetPassword`, params);
};

// 修改密码(短信)
export const resetPasswordBySms = (params) => {
	return new request().requestPost(`/api/v1/auth/resetPasswordBySms`, params);
};